package cn.dianchiyun.protocol.exception;

public class DataException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    protected String errorCode = "-1";
    protected String errorMessage = "系统错误";
    protected String deviceCode = null;
    protected String address = null;

    public DataException() {
        super();
    }

    public DataException(String message) {
        super(message);
    }

    public DataException(String message, Throwable cause) {
        super(message, cause);
    }

    public DataException(Throwable cause) {
        super(cause);
    }

    public DataException(String errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        if (null != errorMessage) {
            this.errorMessage = errorMessage;
        }
    }

    public DataException(String errorCode, String errorMessage, String siteCode, String address) {
        super(errorMessage);
        this.errorCode = errorCode;
        if (null != errorMessage) {
            this.errorMessage = errorMessage;
        }
        if (null != siteCode) {
            this.deviceCode = siteCode;
        }
        if (null != address) {
            this.address = address;
        }
    }

    public DataException(String errorCode, String errorMessage, Throwable cause) {
        super(errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public DataException(String errorCode, String errorMessage, String siteCode, String address, Throwable cause) {
        super(errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.deviceCode = siteCode;
        this.address = address;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public String getDeviceCode() {
        return deviceCode;
    }

    public String getAddress() {
        return address;
    }
}